package com.riccardocardin.structured.concurrency.client;

import com.riccardocardin.structured.concurrency.application.GitHubUserApplicationService;
import com.riccardocardin.structured.concurrency.application.GitHubUserStructuredConcurrentAppService;
import com.riccardocardin.structured.concurrency.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ExecutionException;

import static com.riccardocardin.structured.concurrency.model.Model.GitHubUser;
import static com.riccardocardin.structured.concurrency.model.Model.UserId;

public class GetUserStructuredConcurrentDemo {

    private static final Logger LOGGER = LoggerFactory.getLogger("GitHubApp");

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        UserService userService = new UserServiceImpl();
        RepositoryService repositoryService = new RepositoryServiceImpl();
        GitHubUserService gitHubUserService = new GitHubUserServiceImpl(userService, repositoryService);
        GitHubUserApplicationService userApplicationService = new GitHubUserStructuredConcurrentAppService(gitHubUserService);
        GitHubUser gitHubUser = userApplicationService.findGitHubUser(new UserId(1L));
        LOGGER.info(gitHubUser.toString());
    }
}
